/*
MIT License
 */

#import <Cordova/CDVPlugin.h>
#import "AVFoundation/AVFoundation.h"

@interface CDVCameraCapture : CDVPlugin <AVCaptureVideoDataOutputSampleBufferDelegate>

@property AVCaptureDevice *camera;
@property AVCaptureSession *session;

- (void) startCapture:(CDVInvokedUrlCommand*)command;
- (void) grantPermission:(CDVInvokedUrlCommand*)command;
- (void) stopCapture:(CDVInvokedUrlCommand*)command;
- (BOOL) findCamera: (BOOL) useFrontCamera;
- (BOOL) attachCameraToCaptureSession;
- (void) setupVideoOutput;
- (void) captureOutput: (AVCaptureOutput *) captureOutput
   didOutputSampleBuffer: (CMSampleBufferRef) sampleBuffer
          fromConnection: (AVCaptureConnection *) connection;
- (UIImage *) rotatedImage: (UIImage *) image rotation: (CGFloat) rotation;
- (CGFloat) degreesToRadians:(CGFloat) degrees;

@end
